<?php
	include ("../../../asset/config/koneksi.php");
	//	mengambil data bank yang akan diedit
	$q = mysql_query("SELECT * FROM ruang WHERE id_ruang = '$_GET[kode]'");
	$d = mysql_fetch_array($q);

	// proses penyimpanan update
	$kode = $_POST['kode'];
	if ($kode!='') {
		$q = "UPDATE ruang SET nama_ruang = '".$bank."' WHERE id_ruang = '".$_GET['kode']."'";
		$r = mysql_query($q) or die (mysql_error());
		if($r) {
			$msg = "Data sudah diedit";
		}
		else {
			$msg = "Data tidak bisa diedit";
		}
	}
	$vkode =  $_POST['kode'] ? $_POST['kode'] : $d['id_ruang'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ubah Data </title>
<script language="JavaScript" src="jquery.js"></script>
<script>
	$(document).ready(function(){
		$("#close").click(function(){
			$("#form").hide("slow");
		});
	});
</script>
</head>

<body>
<form id="forms" method="POST" onSubmit="return submitForm('<?=$_SERVER['PHP_SELF'];?>?kode=<?=$_GET['kode'];?>')">
<fieldset>
<legend> Form Ubah Data Ruang </legend>
	<div align="right"><img id="close" src="images/close.png" title="Close Form" /></div>
	<table class="nobeorder">
		<?
			if ($msg!='') {
				echo "
				<tr>
					<td> </td>
					<td> </td>
					<td> $msg </td>
				</tr>";
			}
		?>
		<tr>
			<td> Ruang </td>
			<td> : </td>
			<td> 
				<input type='text' name='bank' value='<?=$d['nama_ruang'];?>' class='input_field' disabled> 
				<input type='hidden' name='kode' value='<?=$vkode;?>' class='input_field'>
			</td>
		</tr>
		<tr>
			<td> </td>
			<td> </td>
			<td> 
				<input type='submit' name='ubah' class='button' value='Ubah'>  
				<input type='reset' name='reset' class='button' value='Reset'> 
			</td>
		</tr>
	</table>
</form>
</fieldset>
</body>
</html>
